(function (line) {
    var ArrayProto = Array.prototype,
        slice = ArrayProto.slice,
        indexOf=ArrayProto.indexOf;
    line.extend(line, {
        indexOf:(function () {
            if (ArrayProto.indexOf) {
                return function (obj, target) {
                    return ArrayProto.indexOf.call(obj,target);
                };
            } else {
                return function (obj, target) {
                    for (var i = 0, len = obj.length; i < len; i++) {
                        if (target === obj[i]) {
                            return i;
                        }
                    }
                    return -1;
                };
            }
        }()),
        lastIndexOf:(function () {
            if (ArrayProto.lastIndexOf) {
                return function (obj, target) {
                    return ArrayProto.lastIndexOf.call(obj,target);
                };
            } else {
                return function (obj, target) {
                    var i = obj.length;
                    while (i--) {
                        if (target === obj[i]) {
                            return i;
                        }
                    }
                    return -1;
                };
            }
        }()),
        unique:function (array) {
            var table = {},
                result = [],
                tableKey;
            line.each(array, function (val) {
                if (line.isObject(val)) {
                    if (line.indexOf(result, val) === -1) {
                        result.push(val);
                    }
                } else {
                    tableKey = line.getType(val) + val;
                    if (!table[tableKey]) {
                        result.push(val);
                        table[tableKey] = true;
                    }
                }
            });
            return result;
        },
        forEach:(function () {
            if (ArrayProto.forEach) {
                return function (obj, callback, context) {
                    return ArrayProto.forEach.call(obj,callback || null, context);
                };
            } else {
                return function (obj, callback, context) {
                    for (var i = 0, len = obj.length; i < len; i++) {
                        callback.call(context || this, obj[i], i, obj);
                    }
                };
            }
        }()),
        every:(function () {
            if (ArrayProto.every) {
                return function (obj, fn, context) {
                    return ArrayProto.every.call(obj,fn, context);
                };
            } else {
                return function (obj, fn, context) {
                    var result = true;
                    line.each(obj, function (val, key, vObj) {
                        return result = result && fn.call(context, val, key, vObj);
                    });
                    return !!result;
                };
            }
        }()),
        some:(function () {
            if (ArrayProto.some) {
                return function (obj, fn, context) {
                    return ArrayProto.some.call(obj,fn, context);
                };
            } else {
                return function (obj, fn, context) {
                    var result = false;
                    line.each(obj, function (val, key, vObj) {
                        return !(result = result || fn.call(context, val, key, vObj));
                    });
                    return !!result;
                };
            }
        }()),
        map:(function () {
            if (ArrayProto.map) {
                return function (obj, fn, context) {
                    return ArrayProto.map.call(obj,fn, context);
                };
            } else {
                return function (obj, fn, context) {
                    var result = [];
                    line.each(obj, function (val, key, vObj) {
                        result.push(fn.call(context, val, key, vObj));
                    });
                    return result;
                };
            }
        }()),
        filter:(function () {
            if (ArrayProto.filter) {
                return function (obj, fn, context) {
                    return ArrayProto.filter.call(obj,fn, context);
                };
            } else {
                return function (obj, fn, context) {
                    var result = [];
                    line.each(obj, function (val, key, vObj) {
                        if (fn.call(context, val, key, vObj)) {
                            result.push(val);
                        }
                    });
                    return result;
                };
            }
        }())
    });
})(line);